﻿package com.findMoneyGame.pages.achievement {
	
	import flash.events.Event;

	import com.findMoneyGame.models.Model;
	import com.findMoneyGame.models.User;
	import com.findMoneyGame.interfaceComponents.MyButton;
	

	public class AmountAchievementItem extends MyButton {
		
		private var _limit : int;

		protected function get limit () { return _limit; }
		protected override function get activeFrame () { return 'active' + enableSuffix; }
		protected override function get deactiveFrame () { return 'deactive' + enableSuffix; }
		protected function get amount () : int { return 0; }

		protected function get enableSuffix () { return amount >= _limit ? 'Enable' : 'Disable'; }

		public function AmountAchievementItem (limit : int) {
			_limit = limit;
			User.getInst().addEventListener(Model.UPDATE, function (e : Event) { gotoDeactive(); });
			gotoDeactive();
		}
	}
	
}
